#pragma once 

#include <sys/epoll.h>
#include <iostream>
#include <cstring>
#include <cerrno>
#include "LogMessage.hpp"

class Epoll
{
public:
    static int EpollCreate(int size = 20)
    {   
        int epfd = epoll_create(size);
        return epfd;
    }

    static bool EpollCtrl(int epfd, int op, int fd, uint32_t event)
    {
        epoll_event ev;
        ev.events = event;
        ev.data.fd = fd;
        int n = epoll_ctl(epfd, op, fd, &ev);
        return n == 0;
    }

    static int EpollWait(int epfd, epoll_event* events, int events_size, int timeout)
    {
        return epoll_wait(epfd, events, events_size, timeout);
    }
};